﻿using System.ComponentModel;
using RaytracerLib.RenderableObjects;
using RaytracerLib.Materials;
using RaytracerLib.UVMappers;

namespace Raytracer.PropertyGridDecorators
{
    public class ConeObjectProperties : RenderableObjectProperties
    {
        private ConeObject m_cone;

        public ConeObjectProperties(ConeObject a_cone) :
            base(a_cone)
        {
            m_cone = a_cone;
        }

        [Category(Categories.PROPERTIES)]
        [TypeConverter(typeof(DoubleConverter))]
        public double Radius
        {
            get
            {
                return m_cone.Radius;
            }
            set
            {
                m_cone.Radius = value;
            }
        }

        [Category(Categories.PROPERTIES)]
        [TypeConverter(typeof(DoubleConverter))]
        public double Height
        {
            get
            {
                return m_cone.Height;
            }
            set
            {
                m_cone.Height = value;
            }
        }

        [TypeConverter(typeof(MaterialConverter))]
        [Category(Categories.PROPERTIES)]
        [DisplayName("Base material")]
        public Material BaseMaterial
        {
            get
            {
                return m_cone.BaseMaterial;
            }
            set
            {
                if (value == null)
                    return;

                m_cone.BaseMaterial = value;
            }
        }
    }
}